package com.aerospace.serviceprovider.socket;

import java.io.DataOutputStream;
import java.net.Socket;

public class SocketSendServer {
    public static void main(String[] args) {
        SocketSendServer.start();
    }

    public static void start(){
        try{
            Socket s = SessionUtils.socketMap.get("client");
            System.out.println(s);
            if (s != null){
                System.out.println(s.getInetAddress().getHostAddress());
                String serverMessage = "服务端向客户端发送消息";
                DataOutputStream ps = new DataOutputStream(s.getOutputStream());
                ps.writeUTF(serverMessage);
                ps.flush();
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
